package com.wangchao.administrator.zenmechi.ui.registactivity;

import com.wangchao.administrator.zenmechi.base.IView;

import rx.Subscriber;

/**
 * Created by cbb on 2016/10/18.
 * Email: 1023151857@qq.com
 */
public class RegistPresenter implements RegistContract.Presenter {
    private RegistContract.View view;
    private RegistModle modle;
    public RegistPresenter(RegistContract.View view){
        this.view=view;
        this.modle=new RegistModle();
    }
    @Override
    public void getData(String name, String pwd) {
        modle.addData(name, pwd, new Subscriber<String>() {
            @Override
            public void onCompleted() {

            }

            @Override
            public void onError(Throwable e) {
                view.registFailed("注册失败"+e.getMessage());
            }

            @Override
            public void onNext(String s) {
                view.registSuccess(s);
            }
        });
    }

    @Override
    public void detachView() {

    }

    @Override
    public void attachView(IView view) {

    }
}
